package com.lupan.jedis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 说明：redis数据处理类
 *
 * @author lupan
 * @version 2017/2/13 16:33
 */

@Component
public class RedisDao {

    @Resource(name="redisTemplate")
    private ValueOperations<String,String> valueOperations;
    @Resource(name="redisTemplate")
    private HashOperations<String,String,Object> hashOperations;
    @Autowired
    private RedisUtil redisUtil;

    public void setValue(String key,String value){
        valueOperations.set(key,value);
    }

    public void delete(String key){
        redisUtil.delete(key);
    }

    public void setHash(String key,Map<String,String> map){
        hashOperations.putAll(key,map);
    }
}
